import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login.vue'
import Register from '../components/Register.vue'
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue'
import UserInformation from '../components/user/UserInformation.vue'
import UserOrders from '../components/user/UserOrders.vue'
import UserOrdersToMe from '../components/user/UserOrdersToMe.vue'
import ShopCart from '../components/shopCart/ShopCart'
import Release from '../components/Release.vue'
import DailyNecessities from '../components/commodity/DailyNecessarites.vue'
import Places from '../components/commodity/Places'
import Details from '../components/details/Details'
import UserUpdate from '../components/user/UserUpdate'
import UserRecharge from '../components/user/UserRecharge'

Vue.use(VueRouter)

// 路由规则数组
const routes = [
  {path: '/', redirect: '/login'},//重定向路由规则
  {path: '/login',component:Login},
  {path: '/register',component:Register},
  {
    path: '/home',
    component:Home, 
    redirect:'/welcome',
    children:[
      {path: '/welcome',component:Welcome},
      {path: '/userInformation',component:UserInformation},
      {path: '/userOrders',component:UserOrders},
      {path: '/userOrdersToMe',component:UserOrdersToMe},
      {path: '/shopCart',component:ShopCart},
      {path: '/release',component:Release},
      {path: '/dailyNecessarites',component:DailyNecessities},
      {path: '/places',component:Places},
      {path: '/details',component:Details,name:'Details'},//!!!!!!!!!
      {path: '/userUpdate',component:UserUpdate},
      {path: '/userRecharge',component:UserRecharge}
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router